import Vue from 'vue'
import main from './main.vue'

var Toast = Vue.extend(main)

var isCan = true

var ToastFn = (text) => {
  const app = document.getElementById('app')
  var toastDiv = new Toast().$mount(document.createElement('div'))
  toastDiv.text = '哈哈哈哈哈哈哈'
  if (isCan) {
    app.appendChild(toastDiv.$el)
    isCan = false
    setTimeout(() => {
      app.removeChild(toastDiv.$el)
      isCan = true
    }, 2000)
  }
}

export default ToastFn